package com.visionet.school.app.web.repository.tclass;

import com.visionet.school.app.web.entity.tclass.SchoolClass;
import com.visionet.school.app.web.entity.tclass.vo.SchoolClassVo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;

/**
 * Created by hxpeng on 2017/3/1.
 */

@Repository
public interface SchoolClassRepository extends PagingAndSortingRepository<SchoolClass,String>,JpaSpecificationExecutor<SchoolClass> {


    @Query("from SchoolClass as sc where sc.id = ?1 and sc.isDeleted = 0 ")
    SchoolClass findOneById(String id);

    @Query("from SchoolClass as sc where sc.className = ?1 and sc.isDeleted = 0 ")
    SchoolClass findOneByClassName(String className);

    Page<SchoolClassVo> findClassPage(SchoolClassVo schoolClassVo, String sortType);

    public SchoolClassVo getClassMember(String id,String memberType);
}
